from todo_api_project.base.mybase import Tools


class creattask_model(Tools):

    # 定义路径
    path = '/task/info'    # 在方法中调用类中的变量  self.变量名

    # 发送注册请求
    def creattask_action(self,title,hb):
        mydata = {
            "title": title,

        }
        res = self.huihua.post(url=self.hosturl+self.path,data=mydata,headers=hb)
        return res.json()

from todo_api_project.api.login_api import login_model

import requests
s = requests.session()
reg = login_model(huihua=s)
msg = reg.login_action(usr='ueuquu1342',pwd='afhahfhai34')
getuserid = msg['userId']
getusertoke = msg['userToken']
hb = {'userid':getuserid,'userToken':getusertoke}
print(hb)
creaktask = creattask_model(huihua=s)
msg = creaktask.creattask_action(title='香蕉',hb=hb)
print(msg)
gettaskid = msg['taskid']